#
# Common cmake entry.
# At this part of build process we setting up compiper,
# extra variables, extra libraries, test envt.
#
# Export vars :
# CMAKE_BUILD_TYPE [Debug|Releas|RelWithDebInfo]
# CORE_SHARED [TRUE|FALSE] 
#
cmake_minimum_required(VERSION 2.8)

# Add build configurations
if(CMAKE_CONFIGURATION_TYPES)
	set(CMAKE_CONFIGURATION_TYPES
		Debug Release RelWithDebInfo
		CACHE STRING "Supported build types" FORCE
	)
endif(CMAKE_CONFIGURATION_TYPES)

project(signature_scaner)

# Add version to scope
include(${CMAKE_SOURCE_DIR}/CMakeExtra/ProjectVersion.cmake)

# Set build option to default value(only if we does not set the build type early)
if(NOT DEFINED CMAKE_BUILD_TYPE)
	message(STATUS "Setup to default build configuration[Debug]")
    set(CMAKE_BUILD_TYPE Debug)
else()
	message(STATUS "Setup to ${CMAKE_BUILD_TYPE} build configuration")
endif()

# Define the more convenient variable with more convenient values
set(CPU_TYPE "stub" CACHE INTERNAL "" FORCE)
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL AMD64)
	set(CPU_TYPE "x64" CACHE INTERNAL "" FORCE)
else()
	set(CPU_TYPE "x86" CACHE INTERNAL "" FORCE)
endif()

# Detect and define platform type
set(PLATFORM_TYPE "stub" CACHE INTERNAL "" FORCE)
if(APPLE)
	set(PLATFORM_TYPE "osx" CACHE INTERNAL "" FORCE)
elseif(WIN32)
	set(PLATFORM_TYPE "windows" CACHE INTERNAL "" FORCE)
elseif(UNIX)
	set(PLATFORM_TYPE "unix" CACHE INTERNAL "" FORCE)
endif()

# This file should contain all additional include and link directories
include(${CMAKE_SOURCE_DIR}/CMakeExtra/PlatformConfig.cmake)

# Specifying directory for executable and libraries files with 
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/../bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/../lib)

# contrib
include_directories(${CMAKE_SOURCE_DIR}/contrib)
add_subdirectory(${CMAKE_SOURCE_DIR}/contrib)

# Add sub directories(eg sources, libs, scripts ...)
include_directories(${CMAKE_SOURCE_DIR})
add_subdirectory(${CMAKE_SOURCE_DIR}/Core)

include_directories(${CMAKE_SOURCE_DIR}/Common)
add_subdirectory(${CMAKE_SOURCE_DIR}/Common)

add_subdirectory(${CMAKE_SOURCE_DIR}/Tests)

add_subdirectory(${CMAKE_SOURCE_DIR}/Apps)

